Skip to content

BUG: binary operator method alignment with integer level (GH9463) #9475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jorisvandenbossche
Copy link
Member

Closes #9463

@jreback also related to #6682 (I removed 'join compat' introduced in that PR, as this worked only for level names, and passing level=level works for both level names and integer level numbers)

@jorisvandenbossche jorisvandenbossche added this to the 0.16.0 milestone Feb 12, 2015
# for join compat if we have an unnamed index, but
# are specifying a level join
other_index = other.index
if level is not None and other.index.name is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't being hit anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand the code, this was hit, and this fixed the issue in the PR I linked, but it only fixed it for the case when you provide real level names for level (in this case, other is given the same name, and then Index.join will automatically join on the common level name.
When passing integer number to level, setting this number as the level name does not ensure that Index.join can join it correctly, as there are no common level names.

Another option is to set here the correct level name from self that corresponds to the provided level number, but as passing level=level to join also works (for both cases) and is simpler, I took that option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, your soln seems right/reasonable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok! still have to add a release note

jorisvandenbossche added a commit that referenced this pull request Feb 23, 2015
BUG: binary operator method alignment with integer level (GH9463)
@jorisvandenbossche jorisvandenbossche merged commit 1050adb into pandas-dev:master Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: binary operator methods (eg mul) don't handle integer level
2 participants